#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <math.h>
#include <algorithm>
using namespace std;

int searchInsert(vector<int>& nums, int target) {
    short size=nums.size();
    for(short i=0;i<size;i++){
        if(nums[i]==target)return i;
        else if(nums[i]<target&&(i==size-1||nums[i+1]>target)) return i+1;
    }
    return 0;
}
int main(){
    vector<int>a={1,3,5,6};

    cout<<searchInsert(a,0);
    return 0;
}